using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using JCTimes.DomainModel.Entity;

namespace JCTimes.EFRepository.Mapping
{
    public class PDAFunctionMap : EntityTypeConfiguration<PDAFunction>
    {
        public PDAFunctionMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.FunctionNo)
                .HasMaxLength(50);

            this.Property(t => t.FunctionName)
                .HasMaxLength(50);

            this.Property(t => t.ParentID)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("PDAFunctions");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.FunctionNo).HasColumnName("FunctionNo");
            this.Property(t => t.FunctionName).HasColumnName("FunctionName");
            this.Property(t => t.ParentID).HasColumnName("ParentID");
            this.Property(t => t.OrderID).HasColumnName("OrderID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
        }
    }
}
